package me.zhengjie.modules.easycode.rest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.easycode.service.*;
import me.zhengjie.modules.easycode.service.dto.TypeMapperGroupAddParam;
import me.zhengjie.modules.easycode.service.dto.TypeMapperGroupDeleteParam;
import me.zhengjie.utils.Result;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author guoqing
 * @date 2021-06-17
 **/
@RestController
@RequiredArgsConstructor
@Api(tags = "类型映射器组管理")
@RequestMapping("/bamboo/easycode")
public class TypeMapperGroupController {

    private final TypeMapperGroupService typeMapperGroupService;


    @PostMapping("/add/typeMapperGroup")
    @Log("新增类型映射器组")
    @ApiOperation("新增类型映射器组")
    @PreAuthorize("@el.check('TypeMapperGroup:add')")
    public Result create(@Validated @RequestBody TypeMapperGroupAddParam param) {
        return typeMapperGroupService.create(param);
    }

    @PostMapping("/remove/typeMapperGroupById")
    @Log("删除类型映射器组")
    @ApiOperation("删除类型映射器组")
    @PreAuthorize("@el.check('TypeMapperGroup:del')")
    public Result removeTypeMapperGroupById(@Validated @RequestBody TypeMapperGroupDeleteParam param) {
        return typeMapperGroupService.removeById(param);
    }
}
